home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / tools / dev_libs / feelin040718 / prefs.c < prev    next >
C/C++ Source or Header  |  2004-08-03  |  2KB  |  84 lines

  1. #include <libraries/feelin.h>
  2.  
  3. #include <proto/exec.h>
  4. #include <proto/dos.h>
  5. #include <proto/feelin.h>
  6.  
  7. struct FeelinBase                  *FeelinBase;
  8.  
  9. struct LocalObjectData
  10. {
  11.    FObject                          Editor;
  12. };
  13.  
  14. ///App_New
  15. F_METHOD(ULONG,App_New)
  16. {
  17.    struct LocalObjectData *LOD = F_LOD(Class,Obj);
  18.  
  19.    return F_SuperDo(Class,Obj,Method,
  20.  
  21.       Child, LOD -> Editor =
  22.  
  23.          F_NewObj(FC_PreferenceEditor, FA_Window_Open, TRUE, TAG_DONE),
  24.  
  25.       TAG_MORE, Msg);
  26. }
  27. //+
  28. ///App_ClosePrefs
  29. F_METHOD(void,App_ClosePrefs)
  30. {
  31.    F_Set(Obj,FA_Application_Sleep,TRUE);
  32.  
  33. /* There is a timing problem between pushed methods, DOS  notification  and
  34. preference  handling.  Until I find something better, waiting a second is a
  35. simple (still BAD) solution to avoid semaphore inter-locking. */
  36.  
  37.    Delay(50);
  38.    F_Do(Obj,FM_Application_Shutdown);
  39. }
  40. //+
  41.  
  42. ///Main
  43. void main(void)
  44. {
  45.    struct FeelinMethodEntry MTable[] =
  46.    {
  47.       (FMethod) App_New,          NULL, FM_New,
  48.       (FMethod) App_ClosePrefs,   NULL, FM_Application_ClosePrefs,
  49.        NULL
  50.    };
  51.  
  52.    struct FeelinClass *Class;
  53.    FObject   app;
  54.  
  55.    if (FeelinBase = (APTR) OpenLibrary("feelin.library",FV_VERSION))
  56.    {
  57.       if (Class = F_CreateClass(FA_Class_Super,          FC_Application,
  58.                                 FA_Class_LODSize,        sizeof (struct LocalObjectData),
  59.                                 FA_Class_MethodsTable,   MTable,
  60.                                 TAG_DONE))
  61.       {
  62.          app = F_NewObj(Class -> Name,
  63.             FA_Application_Title,        "PreferenceEditor",
  64.             FA_Application_Version,      "$VER: Preference Editor 1.00 (2003/08/18)",
  65.             FA_Application_Copyright,    "©2000 - 2003, Olivier LAVIALE",
  66.             FA_Application_Author,       "Olivier LAVIALE <gofromiel@numericable.com>",
  67.             FA_Application_Description,  "Configure GUI",
  68.          End;
  69.  
  70.          if (app)
  71.          {
  72.             F_Do(app,FM_Application_Run);
  73.             F_DisposeObj(app);
  74.          }
  75.  
  76.          F_DeleteClass(Class);
  77.       }
  78.  
  79.       CloseLibrary(FeelinBase);
  80.    }
  81.    else Printf("Unable to open feelin.library v%ld\n",FV_VERSION);
  82. }
  83. //+
  84.